package com.ruoyi.quartz.task;

import org.springframework.stereotype.Component;
import wx.chatbot.SendResult;
import wx.chatbot.WxChatbotClient;
import wx.chatbot.TestConfig;
import wx.chatbot.message.TextMessage;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

/**
 * 定时任务调度测试
 * 
 * @author ruoyi
 */
@Component("ryTask")
public class RyTask
{
    public void ryParams(String params)
    {
        System.out.println("执行有参方法：" + params);
    }

    public void ryNoParams()
    {
        System.out.println("执行无参方法");
    }
    public void morningNotebook(String params)
    {
        TextMessage message = new TextMessage(params);
        List<String> mentionedMobileList=new ArrayList<String>();
        // mentionedMobileList.add("1832135XXXX");//@群内成员  手机号
        message.setMentionedMobileList(mentionedMobileList);
        //message.setIsAtAll(true);//@所有人
        SendResult result = null;
        try {
            result = WxChatbotClient.send(TestConfig.CHATBOT_WEBHOOK, message);
        } catch (IOException e) {
            e.printStackTrace();
        }
        System.out.println(result);
    }
    public void nightNotebook(String params)
    {
        TextMessage message = new TextMessage(params);
        List<String> mentionedMobileList=new ArrayList<String>();
        // mentionedMobileList.add("1832135XXXX");//@群内成员  手机号
        message.setMentionedMobileList(mentionedMobileList);
        message.setIsAtAll(true);//@所有人
        SendResult result = null;
        try {
            result = WxChatbotClient.send(TestConfig.CHATBOT_WEBHOOK, message);
        } catch (IOException e) {
            e.printStackTrace();
        }
        System.out.println(result);
    }
}
